<template>
  <div>
    <el-row>
      <el-col :span="8" >
        <h4 style="margin:0">
          <span>问题管理</span>
          <span v-show="checkleng.length>0">
            <el-button class="addBtn" type="success">审核通过</el-button>
            <el-button class="addBtn" type="danger">删除</el-button>
          </span>
        </h4>
      </el-col>
      <el-col :span="16" style="text-align:right">
       
      </el-col>
    </el-row>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="全部" name="first">
        <ques-table v-if="navStatus == -1" :navStatus="navStatus" @checkFun = 'checkShowBtn' ></ques-table>
      </el-tab-pane>

      <el-tab-pane label="待审核" name="second">
       <ques-table v-if="navStatus == 0" :navStatus="navStatus" @checkFun = 'checkShowBtn' ></ques-table>
      </el-tab-pane>

      <el-tab-pane label="审核通过" name="third">
       <ques-table v-if="navStatus == 1" :navStatus="navStatus" @checkFun = 'checkShowBtn' ></ques-table>
      </el-tab-pane>

      <el-tab-pane label="已删除" name="fourth">
       <ques-table v-if="navStatus == 2" :navStatus="navStatus" @checkFun = 'checkShowBtn' ></ques-table>
      </el-tab-pane>
    </el-tabs>
    
    
  </div>
</template>

<script>
  import quesTable from './Dynamic/quesTable'
  import Http from '@/Http/Http'

  export default {
    data() {
      return {
         activeName: 'first',
         checkleng:'',
         navStatus:-1,
        
      }
    },
    components:{
      quesTable
    },
    
    mounted() {
      var obj = document.getElementById('centerbox')
      obj.addEventListener('scroll', this.handleScroll,true)
    },
    destroyed(){
      
      var obj = document.getElementById('centerbox')
      obj.removeEventListener('scroll', this.handleScroll,true)
    },
    methods: {
      
      handleScroll() {
        var scollobj = document.getElementById('centerbox');
        var scrollTop = scollobj.scrollTop;
        const obj = document.getElementById('tab-first');
        const myobj = obj.parentNode.parentNode;
        if(scrollTop> 32){
          myobj.style.position = 'fixed';
          myobj.style.top = 0;
        } else {
          myobj.style.position = 'relative';
        }
      },
      handleClick(tab) {
        this.navStatus = Number(tab.index)-1;
      },
      exportXlxs() {
      },
      
       //搜索
      sheachFun(val){
        
      },
      checkShowBtn(val) {
        this.checkleng = val
      }
    }
  }
</script>
<style>
.el-tabs__nav-wrap::after{
  width:0;
}
</style>
